Backport two frame width functions for 24.3 support
authorjustbur <justin@burkett.cc>
Thu, 5 May 2016 14:30:44 +0000 (10:30 -0400)
committerjustbur <justin@burkett.cc>
Thu, 5 May 2016 14:30:44 +0000 (10:30 -0400)
Fixes #119

which-key.el

index 6788d0168af92e2ac9a1b854f988427952db26b5..c0bf5eca2bee54c33de994d08be6eefe7cc5b245 100644 (file)
@@ -2161,5 +2161,24 @@ Finally, show the buffer."
                    (cancel-timer which-key--paging-timer)
                    (which-key--start-timer))))))
 
+;; backport some functions for 24.3
+
+;; found at https://github.com/Lindydancer/andersl-old-emacs-support/blob/master/andersl-old-emacs-support.el
+(unless (fboundp 'frame-fringe-width)
+  (defun frame-fringe-width (&optional frame)
+    "Return fringe width of FRAME in pixels."
+    (let ((left-pair (assq 'left-fringe (frame-parameters frame)))
+          (right-pair (assq 'right-fringe (frame-parameters frame))))
+      (+ (if left-pair (cdr left-pair) 0)
+         (if right-pair (cdr right-pair) 0)))))
+
+(unless (fboundp 'frame-scroll-bar-width)
+  (defun frame-scroll-bar-width (&optional frame)
+    "Return scroll bar width of FRAME in pixels."
+    (let ((pair (assq 'scroll-bar-width (frame-parameters frame))))
+      (if pair
+          (cdr pair)
+        0))))
+
 (provide 'which-key)
 ;;; which-key.el ends here